const list = [1,2,3,4];
const square = num => {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(num * num)
    }, 1000);
  })
}

list.forEach(async x => {
  const res = await square(x);
  console.log(res);
});

let index = 0
const test = async function test() {
  if(index >= list.length) return;
  let x = list[index++], result;
  result = await square(x);
  console.log(result);
  test();
}
test();